﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media.Animation;

namespace Mammoth.Navigations
{
    public class FadeInNavigationAnimation : INavigationAnimation
    {
        public Storyboard CreateStoryboard(System.Windows.UIElement view, double? from = 0, double? to = 1)
        {
            var fadeIn = new DoubleAnimation()
            {
                From = from,
                To = to,
                Duration = TimeSpan.FromMilliseconds(300)
            };
            Storyboard.SetTarget(fadeIn, view);
            Storyboard.SetTargetProperty(fadeIn, new PropertyPath(UIElement.OpacityProperty));
            var sb = new Storyboard();
            sb.Children.Add(fadeIn);
            return sb;
        }
    }
}
